package com.atguigu.gmall.gmallsugar.mapper;

import com.atguigu.gmall.gmallsugar.bean.KeywordStats;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface KeywordMapper {
    @Select("SELECT\n" +
        "    keyword,\n" +
        "    sum(ct * multiIf(source = 'search', 20, source = 'order', 6, source = 'cart', 3, 0)) AS score\n" +
        "FROM keyword_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY keyword\n" +
        "ORDER BY score DESC\n" +
        "LIMIT #{limit}")
    List<KeywordStats> statsKeyword(@Param("date") int date, @Param("limit") int limit);

    
    
    
}
